3.2.86 \(\int \frac {x^2}{a+b \cos (c+d x)} \, dx\) [186]

3.2.86.1 Optimal result
3.2.86.2 Mathematica [A] (verified)
3.2.86.3 Rubi [A] (verified)
3.2.86.4 Maple [F]
3.2.86.5 Fricas [B] (verification not implemented)
3.2.86.6 Sympy [F]
3.2.86.7 Maxima [F(-2)]
3.2.86.8 Giac [F]
3.2.86.9 Mupad [F(-1)]

3.2.86.1 Optimal result

Integrand size = 16, antiderivative size = 329 \[ \int \frac {x^2}{a+b \cos (c+d x)} \, dx=-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}+\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d}-\frac {2 x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^2}+\frac {2 x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^2}-\frac {2 i \operatorname {PolyLog}\left (3,-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^3}+\frac {2 i \operatorname {PolyLog}\left (3,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{\sqrt {a^2-b^2} d^3} \]

output
-I*x^2*ln(1+b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2)))/d/(a^2-b^2)^(1/2)+I*x^2* 
ln(1+b*exp(I*(d*x+c))/(a+(a^2-b^2)^(1/2)))/d/(a^2-b^2)^(1/2)-2*x*polylog(2 
,-b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2)))/d^2/(a^2-b^2)^(1/2)+2*x*polylog(2, 
-b*exp(I*(d*x+c))/(a+(a^2-b^2)^(1/2)))/d^2/(a^2-b^2)^(1/2)-2*I*polylog(3,- 
b*exp(I*(d*x+c))/(a-(a^2-b^2)^(1/2)))/d^3/(a^2-b^2)^(1/2)+2*I*polylog(3,-b 
*exp(I*(d*x+c))/(a+(a^2-b^2)^(1/2)))/d^3/(a^2-b^2)^(1/2)
 
3.2.86.2 Mathematica [A] (verified)

Time = 0.61 (sec) , antiderivative size = 255, normalized size of antiderivative = 0.78 \[ \int \frac {x^2}{a+b \cos (c+d x)} \, dx=\frac {-2 d x \operatorname {PolyLog}\left (2,\frac {b e^{i (c+d x)}}{-a+\sqrt {a^2-b^2}}\right )-i \left (d^2 x^2 \log \left (1-\frac {b e^{i (c+d x)}}{-a+\sqrt {a^2-b^2}}\right )-d^2 x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )+2 i d x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )+2 \operatorname {PolyLog}\left (3,\frac {b e^{i (c+d x)}}{-a+\sqrt {a^2-b^2}}\right )-2 \operatorname {PolyLog}\left (3,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )\right )}{\sqrt {a^2-b^2} d^3} \]

input
Integrate[x^2/(a + b*Cos[c + d*x]),x]
 
output
(-2*d*x*PolyLog[2, (b*E^(I*(c + d*x)))/(-a + Sqrt[a^2 - b^2])] - I*(d^2*x^ 
2*Log[1 - (b*E^(I*(c + d*x)))/(-a + Sqrt[a^2 - b^2])] - d^2*x^2*Log[1 + (b 
*E^(I*(c + d*x)))/(a + Sqrt[a^2 - b^2])] + (2*I)*d*x*PolyLog[2, -((b*E^(I* 
(c + d*x)))/(a + Sqrt[a^2 - b^2]))] + 2*PolyLog[3, (b*E^(I*(c + d*x)))/(-a 
 + Sqrt[a^2 - b^2])] - 2*PolyLog[3, -((b*E^(I*(c + d*x)))/(a + Sqrt[a^2 - 
b^2]))]))/(Sqrt[a^2 - b^2]*d^3)
 
3.2.86.3 Rubi [A] (verified)

Time = 1.24 (sec) , antiderivative size = 319, normalized size of antiderivative = 0.97, number of steps used = 9, number of rules used = 8, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.500, Rules used = {3042, 3802, 2694, 27, 2620, 3011, 2720, 7143}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {x^2}{a+b \cos (c+d x)} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {x^2}{a+b \sin \left (c+d x+\frac {\pi }{2}\right )}dx\)

\(\Big \downarrow \) 3802

\(\displaystyle 2 \int \frac {e^{i (c+d x)} x^2}{2 e^{i (c+d x)} a+b e^{2 i (c+d x)}+b}dx\)

\(\Big \downarrow \) 2694

\(\displaystyle 2 \left (\frac {b \int \frac {e^{i (c+d x)} x^2}{2 \left (a+b e^{i (c+d x)}-\sqrt {a^2-b^2}\right )}dx}{\sqrt {a^2-b^2}}-\frac {b \int \frac {e^{i (c+d x)} x^2}{2 \left (a+b e^{i (c+d x)}+\sqrt {a^2-b^2}\right )}dx}{\sqrt {a^2-b^2}}\right )\)

\(\Big \downarrow \) 27

\(\displaystyle 2 \left (\frac {b \int \frac {e^{i (c+d x)} x^2}{a+b e^{i (c+d x)}-\sqrt {a^2-b^2}}dx}{2 \sqrt {a^2-b^2}}-\frac {b \int \frac {e^{i (c+d x)} x^2}{a+b e^{i (c+d x)}+\sqrt {a^2-b^2}}dx}{2 \sqrt {a^2-b^2}}\right )\)

\(\Big \downarrow \) 2620

\(\displaystyle 2 \left (\frac {b \left (\frac {2 i \int x \log \left (\frac {e^{i (c+d x)} b}{a-\sqrt {a^2-b^2}}+1\right )dx}{b d}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}\right )}{2 \sqrt {a^2-b^2}}-\frac {b \left (\frac {2 i \int x \log \left (\frac {e^{i (c+d x)} b}{a+\sqrt {a^2-b^2}}+1\right )dx}{b d}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b d}\right )}{2 \sqrt {a^2-b^2}}\right )\)

\(\Big \downarrow \) 3011

\(\displaystyle 2 \left (\frac {b \left (\frac {2 i \left (\frac {i x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d}-\frac {i \int \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )dx}{d}\right )}{b d}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}\right )}{2 \sqrt {a^2-b^2}}-\frac {b \left (\frac {2 i \left (\frac {i x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d}-\frac {i \int \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )dx}{d}\right )}{b d}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b d}\right )}{2 \sqrt {a^2-b^2}}\right )\)

\(\Big \downarrow \) 2720

\(\displaystyle 2 \left (\frac {b \left (\frac {2 i \left (\frac {i x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d}-\frac {\int e^{-i (c+d x)} \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )de^{i (c+d x)}}{d^2}\right )}{b d}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}\right )}{2 \sqrt {a^2-b^2}}-\frac {b \left (\frac {2 i \left (\frac {i x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d}-\frac {\int e^{-i (c+d x)} \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )de^{i (c+d x)}}{d^2}\right )}{b d}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b d}\right )}{2 \sqrt {a^2-b^2}}\right )\)

\(\Big \downarrow \) 7143

\(\displaystyle 2 \left (\frac {b \left (\frac {2 i \left (\frac {i x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d}-\frac {\operatorname {PolyLog}\left (3,-\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{d^2}\right )}{b d}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{a-\sqrt {a^2-b^2}}\right )}{b d}\right )}{2 \sqrt {a^2-b^2}}-\frac {b \left (\frac {2 i \left (\frac {i x \operatorname {PolyLog}\left (2,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d}-\frac {\operatorname {PolyLog}\left (3,-\frac {b e^{i (c+d x)}}{a+\sqrt {a^2-b^2}}\right )}{d^2}\right )}{b d}-\frac {i x^2 \log \left (1+\frac {b e^{i (c+d x)}}{\sqrt {a^2-b^2}+a}\right )}{b d}\right )}{2 \sqrt {a^2-b^2}}\right )\)

input
Int[x^2/(a + b*Cos[c + d*x]),x]
 
output
2*((b*(((-I)*x^2*Log[1 + (b*E^(I*(c + d*x)))/(a - Sqrt[a^2 - b^2])])/(b*d) 
 + ((2*I)*((I*x*PolyLog[2, -((b*E^(I*(c + d*x)))/(a - Sqrt[a^2 - b^2]))])/ 
d - PolyLog[3, -((b*E^(I*(c + d*x)))/(a - Sqrt[a^2 - b^2]))]/d^2))/(b*d))) 
/(2*Sqrt[a^2 - b^2]) - (b*(((-I)*x^2*Log[1 + (b*E^(I*(c + d*x)))/(a + Sqrt 
[a^2 - b^2])])/(b*d) + ((2*I)*((I*x*PolyLog[2, -((b*E^(I*(c + d*x)))/(a + 
Sqrt[a^2 - b^2]))])/d - PolyLog[3, -((b*E^(I*(c + d*x)))/(a + Sqrt[a^2 - b 
^2]))]/d^2))/(b*d)))/(2*Sqrt[a^2 - b^2]))
 

3.2.86.3.1 Defintions of rubi rules used

rule 27
Int[(a_)*(Fx_), x_Symbol] :> Simp[a   Int[Fx, x], x] /; FreeQ[a, x] &&  !Ma 
tchQ[Fx, (b_)*(Gx_) /; FreeQ[b, x]]
 

rule 2620
Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/ 
((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp 
[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x] - Si 
mp[d*(m/(b*f*g*n*Log[F]))   Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x 
)))^n/a)], x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]
 

rule 2694
Int[((F_)^(u_)*((f_.) + (g_.)*(x_))^(m_.))/((a_.) + (b_.)*(F_)^(u_) + (c_.) 
*(F_)^(v_)), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Simp[2*(c/q)   Int 
[(f + g*x)^m*(F^u/(b - q + 2*c*F^u)), x], x] - Simp[2*(c/q)   Int[(f + g*x) 
^m*(F^u/(b + q + 2*c*F^u)), x], x]] /; FreeQ[{F, a, b, c, f, g}, x] && EqQ[ 
v, 2*u] && LinearQ[u, x] && NeQ[b^2 - 4*a*c, 0] && IGtQ[m, 0]
 

rule 2720
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Simp[v/D[v, x] 
   Subst[Int[FunctionOfExponentialFunction[u, x]/x, x], x, v], x]] /; Funct 
ionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; FreeQ 
[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x)) 
*(F_)[v_] /; FreeQ[{a, b, c}, x] && InverseFunctionQ[F[x]]]
 

rule 3011
Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.) 
*(x_))^(m_.), x_Symbol] :> Simp[(-(f + g*x)^m)*(PolyLog[2, (-e)*(F^(c*(a + 
b*x)))^n]/(b*c*n*Log[F])), x] + Simp[g*(m/(b*c*n*Log[F]))   Int[(f + g*x)^( 
m - 1)*PolyLog[2, (-e)*(F^(c*(a + b*x)))^n], x], x] /; FreeQ[{F, a, b, c, e 
, f, g, n}, x] && GtQ[m, 0]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3802
Int[((c_.) + (d_.)*(x_))^(m_.)/((a_) + (b_.)*sin[(e_.) + Pi*(k_.) + (f_.)*( 
x_)]), x_Symbol] :> Simp[2   Int[(c + d*x)^m*E^(I*Pi*(k - 1/2))*(E^(I*(e + 
f*x))/(b + 2*a*E^(I*Pi*(k - 1/2))*E^(I*(e + f*x)) - b*E^(2*I*k*Pi)*E^(2*I*( 
e + f*x)))), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && IntegerQ[2*k] && NeQ 
[a^2 - b^2, 0] && IGtQ[m, 0]
 

rule 7143
Int[PolyLog[n_, (c_.)*((a_.) + (b_.)*(x_))^(p_.)]/((d_.) + (e_.)*(x_)), x_S 
ymbol] :> Simp[PolyLog[n + 1, c*(a + b*x)^p]/(e*p), x] /; FreeQ[{a, b, c, d 
, e, n, p}, x] && EqQ[b*d, a*e]
 
3.2.86.4 Maple [F]

\[\int \frac {x^{2}}{a +\cos \left (d x +c \right ) b}d x\]

input
int(x^2/(a+cos(d*x+c)*b),x)
 
output
int(x^2/(a+cos(d*x+c)*b),x)
 
3.2.86.5 Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 1263 vs. \(2 (283) = 566\).

Time = 0.43 (sec) , antiderivative size = 1263, normalized size of antiderivative = 3.84 \[ \int \frac {x^2}{a+b \cos (c+d x)} \, dx=\text {Too large to display} \]

input
integrate(x^2/(a+b*cos(d*x+c)),x, algorithm="fricas")
 
output
-1/2*(2*b*d*x*sqrt((a^2 - b^2)/b^2)*dilog(-(a*cos(d*x + c) + I*a*sin(d*x + 
 c) + (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b + 1 
) - 2*b*d*x*sqrt((a^2 - b^2)/b^2)*dilog(-(a*cos(d*x + c) + I*a*sin(d*x + c 
) - (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b + 1) 
+ 2*b*d*x*sqrt((a^2 - b^2)/b^2)*dilog(-(a*cos(d*x + c) - I*a*sin(d*x + c) 
+ (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b + 1) - 
2*b*d*x*sqrt((a^2 - b^2)/b^2)*dilog(-(a*cos(d*x + c) - I*a*sin(d*x + c) - 
(b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b + 1) - I* 
b*c^2*sqrt((a^2 - b^2)/b^2)*log(2*b*cos(d*x + c) + 2*I*b*sin(d*x + c) + 2* 
b*sqrt((a^2 - b^2)/b^2) + 2*a) + I*b*c^2*sqrt((a^2 - b^2)/b^2)*log(2*b*cos 
(d*x + c) - 2*I*b*sin(d*x + c) + 2*b*sqrt((a^2 - b^2)/b^2) + 2*a) - I*b*c^ 
2*sqrt((a^2 - b^2)/b^2)*log(-2*b*cos(d*x + c) + 2*I*b*sin(d*x + c) + 2*b*s 
qrt((a^2 - b^2)/b^2) - 2*a) + I*b*c^2*sqrt((a^2 - b^2)/b^2)*log(-2*b*cos(d 
*x + c) - 2*I*b*sin(d*x + c) + 2*b*sqrt((a^2 - b^2)/b^2) - 2*a) + (I*b*d^2 
*x^2 - I*b*c^2)*sqrt((a^2 - b^2)/b^2)*log((a*cos(d*x + c) + I*a*sin(d*x + 
c) + (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b)/b) + ( 
-I*b*d^2*x^2 + I*b*c^2)*sqrt((a^2 - b^2)/b^2)*log((a*cos(d*x + c) + I*a*si 
n(d*x + c) - (b*cos(d*x + c) + I*b*sin(d*x + c))*sqrt((a^2 - b^2)/b^2) + b 
)/b) + (-I*b*d^2*x^2 + I*b*c^2)*sqrt((a^2 - b^2)/b^2)*log((a*cos(d*x + c) 
- I*a*sin(d*x + c) + (b*cos(d*x + c) - I*b*sin(d*x + c))*sqrt((a^2 - b^...
 
3.2.86.6 Sympy [F]

\[ \int \frac {x^2}{a+b \cos (c+d x)} \, dx=\int \frac {x^{2}}{a + b \cos {\left (c + d x \right )}}\, dx \]

input
integrate(x**2/(a+b*cos(d*x+c)),x)
 
output
Integral(x**2/(a + b*cos(c + d*x)), x)
 
3.2.86.7 Maxima [F(-2)]

Exception generated. \[ \int \frac {x^2}{a+b \cos (c+d x)} \, dx=\text {Exception raised: ValueError} \]

input
integrate(x^2/(a+b*cos(d*x+c)),x, algorithm="maxima")
 
output
Exception raised: ValueError >> Computation failed since Maxima requested 
additional constraints; using the 'assume' command before evaluation *may* 
 help (example of legal syntax is 'assume(4*b^2-4*a^2>0)', see `assume?` f 
or more de
 
3.2.86.8 Giac [F]

\[ \int \frac {x^2}{a+b \cos (c+d x)} \, dx=\int { \frac {x^{2}}{b \cos \left (d x + c\right ) + a} \,d x } \]

input
integrate(x^2/(a+b*cos(d*x+c)),x, algorithm="giac")
 
output
integrate(x^2/(b*cos(d*x + c) + a), x)
 
3.2.86.9 Mupad [F(-1)]

Timed out. \[ \int \frac {x^2}{a+b \cos (c+d x)} \, dx=\int \frac {x^2}{a+b\,\cos \left (c+d\,x\right )} \,d x \]

input
int(x^2/(a + b*cos(c + d*x)),x)
 
output
int(x^2/(a + b*cos(c + d*x)), x)